from django.db import models
from django.utils.html import format_html

class IMG(models.Model):
    img = models.ImageField(upload_to='img',verbose_name='图片路径')
    name = models.CharField(max_length=200,verbose_name='图片名称')

    def image_data(self):
        return format_html(
            '<img src="{}" width="100px"/>',
            self.img.url,
        )

    image_data.short_description = u'图片'


    class Meta:
        verbose_name='识别图片'
        verbose_name_plural='识别图片'
